<?php
require_once './core/tools.php';


if (!isset($_POST["id_swf"]))
	die("missing_parameter");


$query = "SELECT * FROM versions_swf WHERE id_swf='".$_POST["id_swf"]."'";

$queryResult = executeSQL($query);

if (!$queryResult){
	die ('{"error":1, "message":"MysqlError :'.addslashes(mysql_error()).'"}' );
}


while ($row = mysql_fetch_array($queryResult, MYSQL_ASSOC)) {
	$major = $row["major"];
	$minor = $row["minor"];
	$build = $row["build"];
}


if (!isset($major)){
	die('{"error":2, "message":"id_swf : '.$_POST["id_swf"].' is unknown"}');
}

	
	
	
if (isset($_POST["inc"]) && $_POST["inc"] == "true"){
	$build++;
	$query = "UPDATE versions_swf SET build=".$build." WHERE id_swf='".$_POST["id_swf"]."'";
	
	$queryResultInc = executeSQL($query);
	
	if (!$queryResultInc){
		die ('{"error":1, "message":"MysqlError :'.addslashes(mysql_error()).'"}' );
	}
}	


?>
major=<?php echo($major . "\n"); ?>
minor=<?php echo($minor . "\n"); ?>
build=<?php echo($build . "\n"); ?>
